home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
batchut
/
y_n_3.zip
/
Y-N.LST
< prev
Wrap
File List
|
1987-08-18
|
7KB
|
177 lines
IBM Personal Computer MACRO Assembler Version 2.00 Page 1-1
Y-N - Ask Y/N in Batch File 08-18-87
1 PAGE 80,132
2 TITLE Y-N - Ask Y/N in Batch File
3 ; * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
4 ; * Y-N *
5 ; * Displays command line and then accepts a Y or N, setting ERRORLEVEL *
6 ; * to 1 or 0 respectively. Used only from BATch files. *
7 ; * Written by: *
8 ; * R. Lehr, 901 Rye Beach Rd., Huron Ohio 44839 *
9 ; * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
10 ; Conversion from ? assembler format to IBM MASM 2.0 format, and trivial *
11 ; bug fixes. 8-18-87 Alan Cox *
12 ; * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
13 ;
14 0000 PROG SEGMENT BYTE PUBLIC 'PROG'
15 ASSUME CS:PROG
16 ASSUME DS:PROG
17 0100 ORG 100H
18 0100 MAIN PROC NEAR
19 0100 E9 0188 R JMP START
20
21 ;* * * * *
22 ;* data *
23 ;* * * * *
24 0103 ?? CHAROUT db ?
25 0104 0A 0D 24 db 10,13,'$'
26 0107 ?? EXITCODE db ?
27 0108 7F [ CMDLN db 127 dup(?)
28 ??
29 ]
30
31 0187 24 db '$'
32
33 ;* * * * *
34 ;* code *
35 ;* * * * *
36 0188 START:
37 ;----- Copy command line -----
38 0188 B8 0081 mov ax,129 ; command line at offset 129 int PSP
39 018B 8B F0 mov si,ax ; (Program Segment Prefix)
40 018D 33 C9 xor cx,cx
41 018F 8A 0E 0080 mov cl,ds:[128] ;Length of command line at offset 128
42 0193 8D 3E 0108 R lea DI,CMDLN
43 0197 83 F9 00 cmp cx,00 ; if command line length > 0 then
44 019A 74 08 je LNEND
45 019C 46 inc si ; skip blank in command line
46 019D 49 dec cx ; and adjust length accordingly
47 019E F3/ A4 rep movsb
48 01A0 C6 05 20 mov [di], byte ptr ' ' ; append 1 blank
49 01A3 47 inc di
50 01A4 C6 05 24 LNEND: mov [di], byte ptr '$' ; append string terminator
51
52 ;----- Display command line -----
53 01A7 B4 09 mov AH,09 ; display command line
54 01A9 8D 16 0108 R lea DX,CMDLN
55 01AD CD 21 int 21h
56
57 ;----- Accept Y or N -----
58 01AF 90 GETYN: nop ; repeat
59 01B0 B4 08 mov AH,08 ; accept keyboard input into AL (no echo)
60 01B2 CD 21 int 21h
61 01B4 3C 00 cmp AL,00 ; if chr(0) not ASCII
62 01B6 75 05 jne UP
63 01B8 CD 21 int 21h ; get and discard scan code
64 01BA EB 21 90 jmp ENDGETYN
65 01BD UP:
66 01BD 24 DF and AL,0DFh ; convert to upper case
67 01BF Y:
68 01BF 3C 59 cmp AL,'Y' ; if Y
69 01C1 75 0B jne N
70 01C3 E8 01E6 R call DISPLAY ; display it
71 01C6 C6 06 0107 R 01 mov EXITCODE,1 ; exitcode = 1
72 01CB EB 12 90 jmp RETURN
73 01CE N:
74 01CE 3C 4E cmp AL,'N' ; else if N
75 01D0 75 0B jne ENDGETYN
76 01D2 E8 01E6 R call DISPLAY ; display it
IBM Personal Computer MACRO Assembler Version 2.00 Page 1-2
Y-N - Ask Y/N in Batch File 08-18-87
77 01D5 C6 06 0107 R 00 mov EXITCODE,0 ; exitcode = 1
78 01DA EB 03 90 jmp RETURN
79 01DD ENDGETYN:
80 01DD EB D0 jmp GETYN ; until Y or N
81
82 01DF RETURN:
83 01DF B4 4C mov ah,04Ch ; return with ERRORLEVEL in AL
84 01E1 A0 0107 R mov al,EXITCODE
85 01E4 CD 21 int 21h
86
87 01E6 MAIN ENDP
88
89 ;* * * * * * * *
90 ;* procedures *
91 ;* * * * * * * *
92 01E6 DISPLAY proc
93 01E6 A2 0103 R mov CHAROUT,AL ; display Y or N and <cr><lf>
94 01E9 B4 09 mov AH,09 ;
95 01EB 8D 16 0103 R lea DX,CHAROUT
96 01EF CD 21 int 21h
97 01F1 C3 ret
98 01F2 DISPLAY endp
99 01F2 PROG ENDS
100 END MAIN
IBM Personal Computer MACRO Assembler Version 2.00 Page Symbols-1
Y-N - Ask Y/N in Batch File 08-18-87
Segments and Groups:
N a m e Size Align Combine Class
PROG . . . . . . . . . . . . . . 01F2 BYTE PUBLIC 'PROG'
Symbols:
N a m e Type Value Attr
CHAROUT. . . . . . . . . . . . . L BYTE 0103 PROG
CMDLN. . . . . . . . . . . . . . L BYTE 0108 PROG Length =007F
DISPLAY. . . . . . . . . . . . . N PROC 01E6 PROG Length =000C
ENDGETYN . . . . . . . . . . . . L NEAR 01DD PROG
EXITCODE . . . . . . . . . . . . L BYTE 0107 PROG
GETYN. . . . . . . . . . . . . . L NEAR 01AF PROG
LNEND. . . . . . . . . . . . . . L NEAR 01A4 PROG
MAIN . . . . . . . . . . . . . . N PROC 0100 PROG Length =00E6
N. . . . . . . . . . . . . . . . L NEAR 01CE PROG
RETURN . . . . . . . . . . . . . L NEAR 01DF PROG
START. . . . . . . . . . . . . . L NEAR 0188 PROG
UP . . . . . . . . . . . . . . . L NEAR 01BD PROG
Y. . . . . . . . . . . . . . . . L NEAR 01BF PROG
49992 Bytes free
Warning Severe
Errors Errors
0 0
Y-N - Ask Y/N in Batch File
Symbol Cross Reference (# is definition) Cref-1
CHAROUT. . . . . . . . . . . . . 24# 93 95
CMDLN. . . . . . . . . . . . . . 27# 42 54
DISPLAY. . . . . . . . . . . . . 70 76 92# 98
ENDGETYN . . . . . . . . . . . . 64 75 79#
EXITCODE . . . . . . . . . . . . 26# 71 77 84
GETYN. . . . . . . . . . . . . . 58# 80
LNEND. . . . . . . . . . . . . . 44 50#
MAIN . . . . . . . . . . . . . . 18# 87 100
N. . . . . . . . . . . . . . . . 69 73#
PROG . . . . . . . . . . . . . . 14# 14 15 16 99
RETURN . . . . . . . . . . . . . 72 78 82#
START. . . . . . . . . . . . . . 19 36#
UP . . . . . . . . . . . . . . . 62 65#
Y. . . . . . . . . . . . . . . . 67#
14 Symbols
62338 Bytes Free